{% extends "cms/cms_board.html" %}

{% block board_body %}
        <table class="table">
          <thead>
            <tr>
              <th scope="col">序号</th>
              <th scope="col">板块名</th>
              <th scope="col">状态</th>
              <th scope="col" class="text-center">操作</th>
            </tr>
          </thead>
      <tbody>
      {% for board in boards %}
        <tr>
          <th scope="row">{{ loop.index }}</th>
          <td>{{ board.name }}</td>
          <td>
              {% if board.is_active %}
                  <span class="text-success">上线中</span>
              {% else %}
                  <span class="text-danger">已下线</span>
              {% endif %}
          </td>
          <td class="text-center">
              {% if board.is_active %}
                <button type="button" class="btn btn-danger btn-active" data-is-active="1" data-board-id="{{ board.id }}">下线分类</button>
              {% else %}
                  <button type="button" class="btn btn-success btn-active" data-is-active="0" data-board-id="{{ board.id }}">上线分类</button>
              {% endif %}
                <button type="button" class="btn btn-warning btn-edit" data-board-id="{{ board.id }}" data-board-name="{{ board.name }}" data-toggle="modal" data-target="#exampleModal">修改分类</button>
          </td>
        </tr>
      {% endfor %}
      </tbody>
    </table>

    <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title" id="exampleModalLabel">修改分类名称</h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body">
            <form>
              <div class="form-group">
                <label for="exampleInput1">分类名</label>
                <input type="text" class="form-control" id="exampleInput1"  aria-describedby="emailHelp">
              </div>

            </form>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
            <button type="button" class="btn btn-primary" id="btn-edit-name">修改</button>
          </div>
        </div>
      </div>
    </div>


{% endblock %}